# We have a population of different colored dots. There # are 7 different colors and we believe that the proportion # of each color is 1/7. We want to test that null # hypothesis. # # The population of dots is given in the file # goodness dots.pdf # # Take a sample of convenience by looking # at blocks 600 and 2300. They are shown in # the file # blocks of dots.pdf # # Then, count the number of each color in our sample. # Here is the count of colors # # color | 600 | 2300 | total # -------+--------+-------+-------- # orange| 16 | 13 | 29 # purple| 17 | 11 | 28 # black | 7 | 9 | 16 # yellow| 12 | 27 | 39 # green | 20 | 8 | 28 # blue | 14 | 16 | 30 # red | 14 | 16 | 30 # -------+--------+-------+-------- # total | 100 | 100 | 200 # # Now do a hypothesis test with the null hypothesis # that the proportion of each color is 1/7 # against the alternative that it is not 1/7 # and do the test at the 0.05 level of significance. # We should not do this because we are just doing # multiple tests where we could be doing a single # goodness of fit test. However, it is tempting to # use a test we had learned before. source("../hypo_prop.R") hypoth_test_prop(1/7, 29,200,0,0.05) # orange hypoth_test_prop(1/7, 28,200,0,0.05) # purple hypoth_test_prop(1/7, 16,200,0,0.05) # black hypoth_test_prop(1/7, 39,200,0,0.05) # yellow hypoth_test_prop(1/7, 28,200,0,0.05) # green hypoth_test_prop(1/7, 30,200,0,0.05) # blue hypoth_test_prop(1/7, 30,200,0,0.05) # red # Now do the test for all of the values as a # goodness of fit test source("../goodfit.R") goodfit(c("Orange","Purple","Black","Yellow","Green","Blue","Red"), rep(1/7,7), c(29, 28, 16, 39, 28, 30, 30), 0.05, FALSE)